import http from "@/utils/http";

// 获取-全部分类(包含推荐商品)
export const getCategoryAPI = () => { return http({ method: 'GET', url: 'home/category/head' }) }

//获取- 轮播图数据
export const getBannerAPI = (params = {}) => {
    const { distributionSite = '1' } = params
    return http(
        {
            method: 'GET',
            url: '/home/banner',
            params: { distributionSite }
        }
    )
}

//获取- 新鲜好物
export const getNewsAPI = () => { return http({ method: 'GET', url: '/home/new' }) }

//获取- 人气推荐
export const getHotsAPI = () => { return http({ method: 'GET', url: '/home/hot' }) }

//获取- 商品详情
export const getGoodsAPI = () => { return http({ method: 'GET', url: '/home/goods' }) }

//获取二级分类
export const getReclassifyAPI = (id) => { return http({ method: 'GET', url: `/category`, params: { id } }) }

//获取二级分类面包屑导航
export const getCategoryFilterAPI = (id) => { return http({ method:'GET', url: '/category/sub/filter', params: { id } }) }

// 获取导航数据
/**
 * @description: 获取导航数据
 * @data { 
     categoryId: 1005000 ,
     page: 1,
     pageSize: 20,
     sortField: 'publishTime' | 'orderNum' | 'evaluateNum'
   } 
 * @return {*}
 */
   export const getSubCategoryAPI = (data) => {
    return http({
      url:'/category/goods/temporary',
      method:'POST',
      data
    })
  }